#include<iostream>
using namespace std;
int n;
char a, b, c;

void move(int x, char begin, char tmp, char end)
{
	if(x == 0) return;
	move(x - 1, begin, end, tmp);
	printf("%c->%d->%c\n", begin, x, end);
	move(x - 1, tmp, begin, end);
}

int main()
{
	cin >> n >> a >> b >> c;
	move(n, a, c, b); 
	return 0;
}
